package com.tpsix.security;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

@Data
@Component("projectProperties")
@EnableConfigurationProperties(ProjectConfigurationProperties.class)
@ConfigurationProperties(prefix = "project")
public class ProjectConfigurationProperties {

    public static final String AUTHORIZATION_HEADER = "Authorization";

    public static final String TOKEN_PREFIX = "Bearer ";

    public static final int TOKEN_PREFIX_LENGTH = TOKEN_PREFIX.length();

    private Jwt jwt;

    private Tenant tenant;

    @Data
    public static class Jwt {
        private String secret;
        private long tokenValidityInSeconds;
    }

    @Data
    public static class Tenant {
        private List<String> ignoreTables;
        private String tenantProperty;
        private String defaultUsername;
        private String defaultPassword;
        private List<String> ignoreMenus;
    }

}
